/*
 * 两个正整数的公约数
 *
 */

#include <stdio.h>
#include <string.h>

//even
bool is_even(int num);
//解法一
int gcd_1(int a, int b);
//解法二
int gcd_2(int a, int b);
//解法三
int gcd_3(int a, int b);

bool is_even(int n)
{
    if (n & 1) {
        return false;
    }
    else {
        return true;
    }
}

int gcd_1(int a, int b)
{
    int ret = a % b;
    while (ret) {
        a = b;
        b = ret;
        ret = a % b; 
    }
    return b;
}

int gcd_2(int a, int b)
{
    int ret = a - b;
    while (ret) {
        a = b;
        b = ret;
        ret = a - b; 
    }
    return b;
}

int gcd_3(int a, int b)
{
/*    int ret = 1;
    while (1) {
        if (0 == b) {
            return a;
        }
    }*/
    return b;
}

int main()
{
    int a = 10, b = 3;
    printf("%d\n", gcd_1(a, b));
    //printf("%d\n", gcd_2(a, b));
    printf("%d\n", gcd_3(a, b));
}


